// 组织架构 封装 递归 生成树状结构
export const getTree = (arr, parentId) => {
  const tree = []
  arr.forEach(item => {
    if (item.pid === parentId) {
      tree.push({
        ...item,
        children: getTree(arr, item.id)
      })
    }
  })
  // console.log(tree)
  return tree
}
